const express = require("express")
const bodyParser = require("body-parser")

const app = express()

app.listen(3000,() => {
    console.log('服务已经启动。。。')
})

// bodyParser.json([options])
// bodyParser.raw([options])
// bodyParser.text([options])
const parserBodyMiddleware = bodyParser.urlencoded({extended:false}) //解析queryString类型

app.get('/login',(req,res) => {
    res.sendFile(__dirname+'/06-form.html')
})

app.post('/login', parserBodyMiddleware,(req,res) => {
    console.log(req.body)
    const {username,password} = req.body
    res.send(`账户：${username},密码：${password}`)
})